﻿
@{
    ViewBag.Title = "jsonSearchForm";
}

<h2>jsonSearchForm</h2>

<input id="search" />
<h3>Ket quan</h3>
<div id="result"></div>
@section scripts{
    <script>
        $(function () {
            $("#search").keyup(function () {
                search = $(this).val();
                $.ajax({
                    url: "/SearchAuto/JsonSearch",
                    data: { Name: search },
                    success: function (response) {
                        $("#result").html("");
                        $(response).each(function (index, element) {
                            $("<li/>")
                                .html(index + ". " + element.Name)
                                .appendTo("#result");
                        });
                    }
                });
            });
        });
    </script>
}